# include <epoxy/egl.h>
#endif
+#ifndef IMAGE_FILE_MACHINE_ARM64
+# define IMAGE_FILE_MACHINE_ARM64 0xAA64
+#endif
+
static int debug_indent = 0;
/**
}
}
+static void
+_gdk_win32_check_on_arm64 (GdkWin32Display *display)
+{
+ static gsize checked = 0;
+
+ if (g_once_init_enter (&checked))
+ {
+ HMODULE kernel32 = LoadLibraryW (L"kernel32.dll");
+
+ if (kernel32 != NULL)
+ {
+ display->cpu_funcs.isWow64Process2 =
+ (funcIsWow64Process2) GetProcAddress (kernel32, "IsWow64Process2");
+
+ if (display->cpu_funcs.isWow64Process2 != NULL)
+ {
+ USHORT proc_cpu = 0;
+ USHORT native_cpu = 0;
+
+ display->cpu_funcs.isWow64Process2 (GetCurrentProcess (),
+ &proc_cpu,
+ &native_cpu);
+
+ if (native_cpu == IMAGE_FILE_MACHINE_ARM64)
+ display->running_on_arm64 = TRUE;
+ }
+
+ FreeLibrary (kernel32);
+ }
+
+ g_once_init_leave (&checked, 1);
+ }
+}
+
static void
gdk_win32_display_init (GdkWin32Display *display)
{
display->monitors = G_LIST_MODEL (g_list_store_new (GDK_TYPE_MONITOR));
_gdk_win32_enable_hidpi (display);
+ _gdk_win32_check_on_arm64 (display);
/* if we have DPI awareness, set up fixed scale if set */
if (display->dpi_aware_type != PROCESS_DPI_UNAWARE &&
funcIsProcessDPIAware isDpiAwareFunc;
} GdkWin32User32DPIFuncs;
+/* Detect running architecture */
+typedef BOOL (WINAPI *funcIsWow64Process2) (HANDLE, USHORT *, USHORT *);
+typedef struct _GdkWin32KernelCPUFuncs
+{
+ funcIsWow64Process2 isWow64Process2;
+} GdkWin32KernelCPUFuncs;
+
struct _GdkWin32Display
{
GdkDisplay display;
/* Message filters */
GList *filters;
+
+ /* Running CPU items */
+ guint running_on_arm64 : 1;
+ GdkWin32KernelCPUFuncs cpu_funcs;
};
struct _GdkWin32DisplayClass
#ifdef GDK_WIN32_ENABLE_EGL
EGLDisplay egl_disp;
- disable_wgl = GDK_DISPLAY_DEBUG_CHECK (display, GL_GLES);
+ disable_wgl = GDK_DISPLAY_DEBUG_CHECK (display, GL_GLES) ||
+ display_win32->running_on_arm64;
#endif
if (display_win32->have_wgl